home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 3 / Cream of the Crop 3.iso / c_lang / strpp31.zip / PARSESTR.H < prev    next >
C/C++ Source or Header  |  1994-04-18  |  3KB  |  61 lines

  1. /* -------------------------------------------------------------------- */
  2. /* String++ Version 3.10                                       04/13/94 */
  3. /*                                                                      */
  4. /* Enhanced string class for Turbo C++/Borland C++.                     */
  5. /* Copyright 1991-1994 by Carl W. Moreland                              */
  6. /*                                                                      */
  7. /* parsestr.h                                                           */
  8. /* -------------------------------------------------------------------- */
  9. /* String-derived class for parsing routines.                           */
  10. /* -------------------------------------------------------------------- */
  11.  
  12. #ifndef _PARSESTR_H
  13. #define _PARSESTR_H
  14.  
  15. #include "str.h"
  16.  
  17. class ParseString: public StrPP
  18. {
  19. protected:
  20.   unsigned offset;            // offset for parsing
  21.  
  22. public:
  23.   ParseString();            // default constructor;
  24.   ParseString(const char* p);        // initialize with a char *
  25.   ParseString(const StrPP& s);        // initialize with another String
  26.  ~ParseString(void);
  27.  
  28. protected:
  29.   virtual void SetStr(const char* p);
  30.   virtual void SetStr(const StrPP& s);
  31.   virtual void SetStr(const char c, const int n = 1) {}
  32.   virtual void SetStr(const char* p,   const int pos, const int len = 32767) {}
  33.   virtual void SetStr(const StrPP& s, const int pos, const int len = 32767) {}
  34.   virtual void AddStr(const char c);
  35.   virtual void AddStr(const char* p);
  36.   virtual void AddStr(const StrPP& s);
  37.  
  38. public:
  39.   int  Offset(void) { return offset; }    // return the current offset
  40.   const char* Offset(int n);        // set the absolute offset
  41.   void Reset(void);            // set offset = 0
  42.  
  43.   StrPP& operator=(const char c);    // str1 = char
  44.   StrPP& operator=(const char* p);    // str1 = char*
  45.   StrPP& operator=(const StrPP& s);    // str1 = str
  46.   StrPP& operator=(const int)           { return((StrPP&)STR_NULL); }
  47.   StrPP& operator=(const unsigned int)  { return((StrPP&)STR_NULL); }
  48.   StrPP& operator=(const long)          { return((StrPP&)STR_NULL); }
  49.   StrPP& operator=(const unsigned long) { return((StrPP&)STR_NULL); }
  50.   StrPP& operator=(const float)         { return((StrPP&)STR_NULL); }
  51.   StrPP& operator=(const double)        { return((StrPP&)STR_NULL); }
  52.   const char* operator++();        // ++str - increment strPtr
  53.   const char* operator++(int);        // str++ - increment strPtr
  54.   const char* operator--();        // --str - decrement strPtr
  55.   const char* operator--(int);        // str-- - decrement strPtr
  56.   const char* operator+=(const int);    // str+=n - increment strPtr
  57.   const char* operator-=(const int);    // str-=n - decrement strPtr
  58. };
  59.  
  60. #endif
  61.